<template>
	<div class="page-wrap">
		<!-- 烟团 -->
		<div class="page-content p-0">
			<div class="page-column p-0">
				<div class="page-form p-x-0">
					<el-form
						:model="ruleForm"
						:rules="rules"
						label-position="left"
						label-width="160px"
						ref="form"
						label-suffix="："
					>
						<el-row>
							<el-col :span="24">
								<div class="my_title m-b-20">烟团参数设置</div>
								<el-form-item label="烟团因子指数1" prop="PMXPFAC1001">
									<el-input class="mediumForm" v-model="ruleForm.PMXPFAC1001" size="medium"></el-input>
								</el-form-item>
								<el-form-item label="烟团因子指数2" prop="PMXPFAC2001">
									<el-input class="mediumForm" v-model="ruleForm.PMXPFAC2001" size="medium"></el-input>
								</el-form-item>
								<el-form-item label="临界风速的线性因子" prop="PRSCLCRW001">
									<el-input class="mediumForm" v-model="ruleForm.PRSCLCRW001" size="medium"></el-input>
								</el-form-item>
								<el-form-item label="A到D稳定度线性因子" prop="PRSCLADP001">
									<el-input class="mediumForm" v-model="ruleForm.PRSCLADP001" size="medium"></el-input>
								</el-form-item>
								<el-form-item label="E到F稳定度线性因子" prop="PRSCLEFP001">
									<el-input class="mediumForm" v-model="ruleForm.PRSCLEFP001" size="medium"></el-input>
								</el-form-item>
							</el-col>
						</el-row>
						<div class="separate m-b-20"></div>
						<el-row>
							<el-col :span="24">
								<div class="my_title m-b-20">烟团分隔设置</div>
								<el-form-item label="烟团分隔数量" prop="RDNUMREL001">
									<select-para
										style="width:100%"
										size="medium"
										v-model="ruleForm.RDNUMREL001"
										class="mediumForm"
										:label.sync="ruleForm.RDNUMREL001Name"
										:options="RDNUMRELoptions"
										disabled
										
									></select-para>
									<!-- @change="RDNUMREL001Change" -->
								</el-form-item>
								<el-form-item label="风险区域烟团" prop="compNatureCode">
									<select-para
										style="width:100%"
										size="medium"
										v-model="ruleForm.RDMAXRIS001"
										class="mediumForm"
										disabled
										:label.sync="ruleForm.RDMAXRIS001"
										:options="RDMAXRIS001options"
									></select-para>
								</el-form-item>
								<el-form-item label="烟团数据导入导出">
									<el-button type="primary" size="small" @click="exportExcel">
											<img
												:style="{
													width: '12px',
													height: '12px'
												}"
												src="/img/basic/daochu.png"
												alt
											/>
											&nbsp;导出
										</el-button>
										<el-button type="primary" size="small" @click="daoru">
											<img
												:style="{
													width: '12px',
													height: '12px'
												}"
												src="/img/basic/daoru.png"
												alt
											/>
											&nbsp;导入
										</el-button>
										<input
											ref="file"
											id="img-upload"
											class="selectFile"
											type="file"
											@change="importf(this)"
											accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
										/>
								</el-form-item>
								<el-table ref="multipleTable" :data="ruleForm.RDNUMRELtab" tooltip-effect="dark" border>
									<el-table-column prop="index" label="烟团编号" align="center" min-width="120"></el-table-column>
									<el-table-column prop="RDREFTIM001" label="代表时间点" align="center" min-width="120">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDREFTIM001"
												:prop="'RDNUMRELtab.'+scope.$index+'.RDREFTIM001'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDREFTIM001"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column prop="RDPLHEAT001" label="释放热量（watts）" min-width="120" align="center">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDPLHEAT001"
												:prop="'RDNUMRELtab.'+scope.$index+'.RDPLHEAT001'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDPLHEAT001"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column prop="RDPLHITE001" label="释放高度（m）" align="center" min-width="120">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDPLHITE001"
												:prop="'RDNUMRELtab.'+scope.$index+'.RDPLHITE001'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDPLHITE001"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column prop="RDPLUDUR001" label="释放持续时间（s）" align="center" min-width="120">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDPLUDUR001"
												:prop="'RDNUMRELtab.'+scope.$index+'.RDPLUDUR001'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDPLUDUR001"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column prop="RDPDELAY001" label="释放开始时间（s）" min-width="120" align="center">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.RDPDELAY001"
												:prop="'RDNUMRELtab.'+scope.$index+'.RDPDELAY001'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.RDPDELAY001"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column prop="WEBUILDW001" label="建筑物宽度（m）" align="center" min-width="120">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.WEBUILDH001"
												:prop="'RDNUMRELtab.'+scope.$index+'.WEBUILDW001'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.WEBUILDW001"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column prop="WEBUILDH001" label="建筑物高度（m）" align="center" min-width="120">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.WEBUILDH001"
												:prop="'RDNUMRELtab.'+scope.$index+'.WEBUILDH001'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.WEBUILDH001"
													@blur="getYZ(scope.row)"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column prop="SIGYINIT001" label="Y方向扩散系数初始值(m)" align="center" min-width="120">
										<template slot-scope="scope">
											<div>{{scope.row.SIGYINIT001}}</div>
										</template>
									</el-table-column>
									<el-table-column prop="SIGZINIT001" label="Z方向扩散系数初始值(m)" min-width="120" align="center">
										<template slot-scope="scope">
											<div>{{scope.row.SIGZINIT001}}</div>
										</template>
									</el-table-column>
								</el-table>
							</el-col>
						</el-row>
						<div class="separate m-b-20"></div>
						<el-row>
							<el-col :span="24">
								<div class="my_title m-b-20">烟团释放份额</div>
								<el-form-item label="烟团释放份额" prop="RDRELFRC_VALUE"></el-form-item>
								<el-table
									ref="multipleTable"
									:data="ruleForm.RDRELFRC_VALUEtab"
									tooltip-effect="dark"
									border
								>
									<el-table-column prop="index" label="烟团编号" align="center" min-width="120"></el-table-column>
									<el-table-column
										v-for="(item,index) in this.basic_Data.ISMAXGRP001"
										:key="index"
										:prop="'item'+index"
										:label="'核素分组'+item"
										align="center"
										min-width="120"
									>
										<template slot-scope="scope">
											<el-form-item
												:rules="rules['item'+index]"
												label-width="0px"
												:prop="'RDRELFRC_VALUEtab.'+scope.$index+'.item'+index"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row[item]"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
								</el-table>
							</el-col>
						</el-row>
					</el-form>
				</div>
				<div class="bottom-btn">
					<el-button type="primary" :loading="loading" @click="submitFun">下一步</el-button>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import selectPara from "@/components/selectPara"
import commCheckbox from "@/components/commCheckbox"
import ImageCropper from "@/components/ImageCropper"
import FixBottomButton from "@/components/FixBottomButton"
import ueditor from "@/components/ueditor"
import textLength from "@/components/common/comp/textLength"
import { commPara } from "@/mixins/mixins"
import { mapState } from "vuex"
import FileSaver from "file-saver"
import XLSX from "xlsx"
import {
	v00110,
	v000110E6,
	v0011000,
	v0011001,
	dome,
	selecttext,
} from "@/utils/verify.js"
export default {
	name: "aboutUs",
	props: {
		batchid: String,
	},
	mixins: [commPara],
	components: {
		selectPara,
		ImageCropper,
		textLength,
		commCheckbox,
		FixBottomButton,
		ueditor,
	},

	data() {
		return {
			activeTab: "7",
			ISMAXGRP001: [],

			RDNUMRELoptions: [
				{
					label: "1",
					value: "1",
				},
				{
					label: "2",
					value: "2",
				},
				{
					label: "3",
					value: "3",
				},
				{
					label: "4",
					value: "4",
				},
				{
					label: "5",
					value: "5",
				},
				{
					label: "6",
					value: "6",
				},
				{
					label: "7",
					value: "7",
				},
				{
					label: "8",
					value: "8",
				},
			],
			RDMAXRIS001options: [],
			multipleSelection: [],

			dialogVisible: false,
			ruleForm: {
				PMXPFAC1001: 0.2,
				PMXPFAC2001: 0.25,
				PRSCLCRW001: 1,
				PRSCLADP001: 1,
				PRSCLEFP001: 1,
				RDNUMREL001: "1",
				RDMAXRIS001: "1",
				RDNUMRELtab: [],
				RDRELFRC_VALUEtab: [],
			},
			rules: {
				PMXPFAC1001: [
					{
						validator: v00110,
						trigger: ["change", "blur"],
					},
				],
				PMXPFAC2001: [
					{
						validator: v00110,
						trigger: ["change", "blur"],
					},
				],
				PRSCLCRW001: [
					{
						validator: v000110E6,
						trigger: ["change", "blur"],
					},
				],
				PRSCLADP001: [
					{
						validator: v0011000,
						trigger: ["change", "blur"],
					},
				],
				PRSCLEFP001: [
					{
						validator: v0011001,
						trigger: ["change", "blur"],
					},
				],
				RDREFTIM001: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				RDPLHEAT001: [
					{
						validator: dome(0.0, 1.0e10),
						trigger: ["change", "blur"],
					},
				],
				RDPLHITE001: [
					{
						validator: dome(0.0, 1000.0),
						trigger: ["change", "blur"],
					},
				],
				RDPLUDUR001: [
					{
						validator: dome(60.0, 86400.0),
						trigger: ["change", "blur"],
					},
				],
				RDPDELAY001: [
					{
						validator: dome(60.0, 345600.0),
						trigger: ["change", "blur"],
					},
				],
				WEBUILDH001: [
					{
						validator: dome(1.0, 1000.0),
						trigger: ["change", "blur"],
					},
				],
				SIGYINIT001: [
					{
						validator: dome(0.1, 1000.0),
						trigger: ["change", "blur"],
					},
				],
				SIGZINIT001: [
					{
						validator: dome(0.1, 1000.0),
						trigger: ["change", "blur"],
					},
				],
				item1: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item2: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item3: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item4: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item5: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item6: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item7: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item8: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item9: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				item0: [
					{
						validator: dome(0.0, 1.0),
						trigger: ["change", "blur"],
					},
				],
				// RDNUMREL001: [
				// 	{
				// 		validator: selecttext,
				// 		trigger: ["change", "blur"],
				// 	},
				// ],
			},
			loading: false,
		}
	},
	mounted() {
		this.setData()
	},
	computed: {
		...mapState({
			basic_Data: (state) => state.token.basic_Data,
		}),
	},
	methods: {
		setData() {
			//烟团参数设置
			this.ruleForm.PMXPFAC1001 = this.basic_Data.PMXPFAC1001
			this.ruleForm.PMXPFAC2001 = this.basic_Data.PMXPFAC2001
			this.ruleForm.PRSCLCRW001 = this.basic_Data.PRSCLCRW001
			this.ruleForm.PRSCLADP001 = this.basic_Data.PRSCLADP001
			this.ruleForm.PRSCLEFP001 = this.basic_Data.PRSCLEFP001
			//烟团分割设置
			this.ruleForm.RDNUMREL001 = this.basic_Data.RDNUMREL001
			this.ruleForm.RDMAXRIS001 = this.basic_Data.RDMAXRIS001
			this.ruleForm.RDNUMRELtab = []
			this.ruleForm.RDRELFRC_VALUEtab = []
			for (
				let index = 0;
				index < parseInt(this.basic_Data.RDNUMREL001);
				index++
			) {
				// console.log(this.ruleForm.RDNUMRELtab)
				// console.log(this.ruleForm.RDRELFRC_VALUEtab)

				this.ruleForm.RDNUMRELtab.push({
					index: index + 1,
					RDREFTIM001: "0",
					RDPLHEAT001: "0",
					RDPLHITE001: "0",
					RDPLUDUR001: "0",
					RDPDELAY001: "0",
					WEBUILDW001: "0",
					WEBUILDH001: "0",
					SIGYINIT001: "0",
					SIGZINIT001: "0",
				})

				this.ruleForm.RDRELFRC_VALUEtab.push({
					index: index + 1,
					item0: '1',
					item1: '1',
					item2: '1',
					item3: '1',
					item4: '1',
					item5: '1',
					item6:'1',
					item7: '1',
					item8: '1',
					item9: '1',
				})
			}
			this.RDNUMREL001Change(this.ruleForm.RDNUMREL001)
		},
		exportExcel() {
			//导出Excel
			var that = this
			//要导出数据标题
			var arry = [["代表时间点","释放热量", "释放高度", "持续时间","开始时间","建筑物宽度","建筑物高度"]]
			// 要导出的历史数据
			that.ruleForm.RDNUMRELtab
				.map((a) => {
					var _arry = []
					_arry.push(a.RDREFTIM001.toString())
					_arry.push(a.RDPLHEAT001.toString())
					_arry.push(a.RDPLHITE001.toString())
					_arry.push(a.RDPLUDUR001.toString())
					_arry.push(a.RDPDELAY001.toString())
					_arry.push(a.WEBUILDW001.toString())
					_arry.push(a.WEBUILDH001.toString())
					
					return _arry
				})
				.forEach((a) => {
					arry.push(a)
				})
			/* generate workbook object from table */
			var sheetHistory = XLSX.utils.aoa_to_sheet(arry)
			var workbook = XLSX.utils.book_new()
			XLSX.utils.book_append_sheet(workbook, sheetHistory, "烟团设置")
			// sheetHistory["!cols"] = [{ wpx: 150 }, { wpx: 90 }, { wpx: 150 }] //单元格列宽

			try {
				var wbOut = XLSX.write(workbook, {
					bookType: "xlsx",
					bookSST: true,
					type: "array",
				})
				FileSaver.saveAs(
					new Blob([wbOut], { type: "application/octet-stream" }),
					"烟团设置.xlsx"
				)
			} catch (e) {
				if (typeof console !== "undefined") console.log(e, wbOut)
			}
		},
		importf(obj) {
			//导入数据 
			let _this = this
			let inputDOM = this.$refs.inputer // 通过DOM取文件数据 
			this.file = event.currentTarget.files[0]
			var rABS = false //是否将文件读取为二进制字符串
			var f = this.file
			var reader = new FileReader()
			//if (!FileReader.prototype.readAsBinaryString) {
			FileReader.prototype.readAsBinaryString = function (f) {
				var binary = ""
				var rABS = false //是否将文件读取为二进制字符串
				var pt = this
				var wb //读取完成的数据
				var outdata
				var reader = new FileReader()
				reader.onload = function (e) {
					var bytes = new Uint8Array(reader.result)
					var length = bytes.byteLength
					for (var i = 0; i < length; i++) {
						binary += String.fromCharCode(bytes[i])
					}
					var XLSX = require("xlsx")
					if (rABS) {
						wb = XLSX.read(btoa(fixdata(binary)), {
							//手动转化
							type: "base64",
						})
					} else {
						wb = XLSX.read(binary, {
							type: "binary",
						})
					}
					// outdata就是你想要的东西 excel导入的数据
					outdata = XLSX.utils.sheet_to_json(
						wb.Sheets[wb.SheetNames[0]]
					)
					let groupType = _this.basic_Data.ISMAXGRP001
					let xlsxCols =  Object.keys(outdata[0])
					let xlsxGL = xlsxCols.length - 10
					if(groupType.length != xlsxGL||xlsxGL>9){
						_this.$notify.error({
							title: "上传失败",
							message: '核素分组不正确请重新上传',
							type: "success",
						})
						return false
					}
					let newName = []
					let newCol = []
					xlsxCols.forEach(item=>{
						if(item!='事故序列名称'&&item!='起始时间'&&item!='结束时间'&&item!='持续时间'&&item!='代表时间点'&&item!='释放热量'&&item!='释放高度'&&item!='建筑物高度'&&item!='风险区域烟团'){
							newCol.push(item)
						}
					})
					groupType.forEach(item=>{
						if(item=='铷组'){
							newName.push('贵金属')
						}
						if(item == '铯组'){
							newName.push('碱金属')
						}
						if(item == '惰性气体'){
							newName.push('惰性气体')
						}
						if(item == '卤素'){
							newName.push('卤素')
						}
						if(item == '碲组'){
							newName.push('碲族')
						}
						if(item == '锶组'){
							newName.push('锶')
						}
						if(item == '镧系'){
							newName.push('镧系')
						}
						if(item == '铈族'){
							newName.push('铈组')
						}
						if(item == '钡组'){
							newName.push('钡')
						}
					})
					let arr = newName.filter(function (val) { return newCol.indexOf(val) === -1 })
					// console.log(arr)
					if(arr.length!=0){
						_this.$notify.error({
							title: "上传失败",
							message: '核素分组不正确请重新上传',
							type: "success",
						})
					}
					let groupName = outdata[0]['事故序列名称']
					let rowData=outdata.filter(row=>{
						if(row['事故序列名称']==groupName){
							return row
						}
					})
					// console.log(rowData)
					_this.ruleForm.RDNUMREL001=rowData.length
					_this.ruleForm.RDMAXRIS001=rowData[0]['风险区域烟团']
					_this.ruleForm.RDNUMRELtab = []
					_this.ruleForm.RDRELFRC_VALUEtab = []
					for(let i = 0;i<_this.ruleForm.RDNUMREL001;i++){
						let obj = {
							index: i + 1,
							RDREFTIM001: outdata[i]['代表时间点'],
							RDPLHEAT001: outdata[i]['释放热量'],
							RDPLHITE001: outdata[i]['释放高度'],
							RDPLUDUR001: outdata[i]['持续时间'],
							RDPDELAY001: outdata[i]['起始时间'],
							WEBUILDW001: outdata[i]['建筑物宽度'],
							WEBUILDH001: outdata[i]['建筑物高度'],
							SIGYINIT001: parseFloat(outdata[i]['建筑物高度']) / 4.3,
							SIGZINIT001: parseFloat(outdata[i]['建筑物高度']) / 2.15,
						}
						let rowObj = {
							index: i + 1,
							'铷组': outdata[i]['贵金属'],
							'惰性气体': outdata[i]['惰性气体'],
							'铯组': outdata[i]['碱金属'],
							'锶组': outdata[i]['锶'],
							'镧系': outdata[i]['镧系'],
							'碲组': outdata[i]['碲族'],
							'卤素': outdata[i]['卤素'],
							'钡组': outdata[i]['钡'],
							'铈组': outdata[i]['铈族'],
						}
						_this.ruleForm.RDNUMRELtab.push(obj)
						_this.ruleForm.RDRELFRC_VALUEtab.push(rowObj)
					}
				}
				reader.readAsArrayBuffer(f)
			}
			if (rABS) {
				reader.readAsArrayBuffer(f)
			} else {
				reader.readAsBinaryString(f)
			}
		},
		RDNUMREL001Change(value) {
			this.ruleForm.RDMAXRIS001 = 1
			this.RDMAXRIS001options = []

			for (let index = 1; index <= parseInt(value); index++) {
				let temp = {
					label: index,
					value: index,
				}
				this.RDMAXRIS001options.push(temp)
			}

			this.ruleForm.RDNUMRELtab = []
			this.ruleForm.RDRELFRC_VALUEtab = []
			for (let index = 0; index < parseInt(value); index++) {
				this.ruleForm.RDNUMRELtab.push({
					index: index + 1,
					RDREFTIM001: "0",
					RDPLHEAT001: "0",
					RDPLHITE001: "0",
					RDPLUDUR001: "0",
					RDPDELAY001: "0",
					WEBUILDW001: "0",
					WEBUILDH001: "0",
					SIGYINIT001: "0",
					SIGZINIT001: "0",
				})
				this.ruleForm.RDRELFRC_VALUEtab.push({
					index: index + 1,
					'铷组': '1',
					'惰性气体':  '1',
					'铯组':  '1',
					'锶组':  '1',
					'镧系':  '1',
					'碲组':  '1',
					'卤素':  '1',
					'钡组':  '1',
					'铈组':  '1',
				})
			}
			this.basic_Data.RDREFTIM001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].RDREFTIM001 = item.toString()
			})
			this.basic_Data.RDPLHEAT001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].RDPLHEAT001 = item.toString()
			})
			this.basic_Data.RDPLHITE001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].RDPLHITE001 = item.toString()
			})
			this.basic_Data.RDPLUDUR001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].RDPLUDUR001 = item.toString()
			})
			this.basic_Data.RDPDELAY001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].RDPDELAY001 = item.toString()
			})
			this.basic_Data.WEBUILDW001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].WEBUILDW001 = item.toString()
			})
			this.basic_Data.WEBUILDH001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].WEBUILDH001 = item.toString()
			})
			this.basic_Data.SIGYINIT001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].SIGYINIT001 = item.toString()
			})
			this.basic_Data.SIGZINIT001.forEach((item, index) => {
				this.ruleForm.RDNUMRELtab[index].SIGZINIT001 = item.toString()
			})

			this.basic_Data.RDRELFRC_VALUE.forEach((item, index) => {
				item.forEach((i, n) => {
					this.ruleForm.RDRELFRC_VALUEtab[index][this.basic_Data.ISMAXGRP001[n]] = i.toString()
				})
			})
		},

		getYZ(row) {
			// console.log(row)
			var tempSIGYINIT001 = ""
			var tempSIGZINIT001 = ""
			if (row.WEBUILDH001) {
				tempSIGYINIT001 = parseFloat(row.WEBUILDH001) / 4.3
				tempSIGZINIT001 = parseFloat(row.WEBUILDH001) / 2.15
			} else {
				tempSIGYINIT001 = 0
				tempSIGZINIT001 = 0
			}
			this.ruleForm.RDNUMRELtab[
				row.index - 1
			].SIGYINIT001 = tempSIGYINIT001.toFixed(3)
			this.ruleForm.RDNUMRELtab[
				row.index - 1
			].SIGZINIT001 = tempSIGZINIT001.toFixed(3)
		},
		submitFun() {
			this.$refs.form.validate((valid) => {
				if (valid) {
					let tempRDRELFRC_VALUE = this.ruleForm.RDRELFRC_VALUEtab.map(
						(item) => {
							// console.log(item)
							let tempitem = []
							for (const key in item) {
								if (item.hasOwnProperty(key)) {
									const element = item[key]
									tempitem.push(parseFloat(element))
								}
							}
							tempitem.splice(0, 1)
							tempitem.splice(this.basic_Data.ISMAXGRP001.length)
							// console.log(tempitem)
							return tempitem
						}
					) 
					let tempdata = JSON.parse(JSON.stringify(this.basic_Data))

					tempdata.PMXPFAC1001 = parseFloat(this.ruleForm.PMXPFAC1001)
					tempdata.PMXPFAC2001 = parseFloat(this.ruleForm.PMXPFAC2001)
					tempdata.PRSCLCRW001 = parseFloat(this.ruleForm.PRSCLCRW001)
					tempdata.PRSCLADP001 = parseFloat(this.ruleForm.PRSCLADP001)
					tempdata.PRSCLEFP001 = parseFloat(this.ruleForm.PRSCLEFP001)
					tempdata.RDNUMREL001 = parseInt(this.ruleForm.RDNUMREL001)
					tempdata.RDMAXRIS001 = parseInt(this.ruleForm.RDMAXRIS001)

					tempdata.RDREFTIM001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.RDREFTIM001)
						}
					)
					tempdata.RDPLHEAT001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.RDPLHEAT001)
						}
					)
					tempdata.RDPLHITE001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.RDPLHITE001)
						}
					)
					tempdata.RDPLUDUR001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.RDPLUDUR001)
						}
					)
					tempdata.RDPDELAY001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.RDPDELAY001)
						}
					)
					tempdata.WEBUILDW001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.WEBUILDW001)
						}
					)
					tempdata.WEBUILDH001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.WEBUILDH001)
						}
					)
					tempdata.SIGYINIT001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.SIGYINIT001)
						}
					)
					tempdata.SIGZINIT001 = this.ruleForm.RDNUMRELtab.map(
						(item) => {
							return parseFloat(item.SIGZINIT001)
						}
					)
					tempdata.QIXIANGNAME = ''
					tempdata.RDRELFRC_VALUE = tempRDRELFRC_VALUE
					tempdata.SETPAGEINDEX = this.activeTab
					this.$store.dispatch("upData_basic_Data", tempdata)
					let params = {
						batchid: this.$props.batchid,
						batchinfo: "BASE",
						submitjson: JSON.stringify(tempdata),
					}
					this.$appApi
						.BATCH_SUBMIT(params)
						.then((res) => {
							var str = res.data.substring(0, 1)
							if (str == "E") {
								let message = res.data.substring(6)
								this.$notify.error({
									title: "保存失败！",
									message: message,
									type: "success",
								})
							} else if (str == "S") {
								this.$notify({
									message: "保存成功！",
									type: "success",
								})
								this.$emit("changeActiveTab", this.activeTab)
					            this.$store.dispatch("change_basic_showTab", this.activeTab)
								if(activeTab >=9){
									this.$router.push({
										path: "/home",
									})
								}
							}
						})
						.catch((err) => {
							console.log(err)
						})
					// console.log(this.basic_Data)
					// console.log(this.activeTab)
					// this.$emit("changeActiveTab", this.activeTab)
					// this.$store.dispatch("change_basic_showTab", this.activeTab)
				}
			})
		},
		daoru() {
			this.$refs.file.click()
		},
	},
}
</script>
<style lang="scss" scoped>
.page-flex-row /deep/ .el-collapse-item__header {
	background: #f3f9fe;
}
#img-upload {
	display: none;
}
</style>